window.onload = function(){
    let teaShow = document.getElementsByClassName("teashow")[0];
        let teaShowTop = document.documentElement.scrollTop;
        console.log(teaShowTop);
        if(teaShowTop>=450){
            teaShow.style.animation = "translateTeaShow 1s linear forwards";
        }
        let cookieStr= document.cookie;
        let cookirArr=cookieStr.split(";");
        let bool=false;
        let username;;
        for(let i=0;i<cookirArr.length;i++){
             //去除空格
          let str=cookirArr[i].trim();
     
           let key="username=";
           if(str.startsWith(key)){
             bool=true;
             username=str.substring(key.length,str.length);
             break;
           }
        }
     
        //判断bool标记值
        if(bool){
         console.log(username);
        }else{
             location.href='登录注册.html'
        }
    
    $.ajax({
        type: "post",
        url: "/js/sytea",
        data:null,
        dataType: "json",
        success: function (data) {
            if(data != false){
                console.log("有数据");
            }else{
                console.log("暂无数据")
            }
        }
    })
}
function teaclick(xiabiao){
    
    // let xiabiaoobj ={
    //     xiabiao:num
    // }
    $.ajax({
        type: "post",
        url: "/js/teaclick",
        data:xiabiao,
        dataType: "json",
        success: function (data) {
            if(data){
    window.location.href = '../../Rang茶商店/03茶叶/茶叶简介.html'
            }
        }
    })
}